﻿Imports Entidad
Imports System.Data
Imports System.Data.SqlClient

Public Class CajaDatos

    Function listarCajas() As DataSet
        Dim ds As New DataSet
        Dim conex As New Conexion
        Dim coneccion As New SqlConnection
        Try
            coneccion = conex.conectar()
            coneccion.Open()

            Dim query As String = "SELECT TCA_Codigo,TCA_Descripcion " &
                                  "FROM Tipo_Caja " &
                                  "WHERE TCA_Activo = '1'"

            Dim adapter As New SqlDataAdapter(query, coneccion)
            adapter.Fill(ds)
        Catch ex As SqlException
            MsgBox("La conexión no está disponible.")
        Catch e As Exception
            MsgBox(e.Message)
        Finally
            coneccion.Close()
        End Try

        Return ds
    End Function

End Class
